#ifndef GENDOKUMENT_H
#define GENDOKUMENT_H


#include "ModelSwap.h"
#include "strutturaicone.h"
/////#include "BasicConfig.h"
#include "DB_Manager.h"
#include "CalendarStructure.h"
#include "textprinter.h"

#define IMM_DIMENSIONE_MASSIMA 300
#define ICONAATTRI_LARGO 20






static inline QString Datapdf( QDateTime start )
{
    return start.toString("dd.MM.yy");
}

static inline QPixmap pdftumbs( QPixmap  pixer , int resize )
{
     QPixmap revrender = pixer.scaledToHeight(resize,Qt::SmoothTransformation);
     QRectF clip(1,1,revrender.width(),revrender.height());
     QPainter *p = new QPainter(&revrender);
     p->setRenderHint(QPainter::Antialiasing, true);
     QPen pen;
     pen.setStyle( Qt::SolidLine );
     pen.setWidth( 2 );
     pen.setColor( QColor(Qt::white) );
     p->setPen( pen); 
     p->drawRect(clip);
     return revrender;
}






//
class GenDokument : public QObject
{
     Q_OBJECT
//
public:
GenDokument( DB_Manager * dbin , int db_id , const QString language ,  QObject* parent = 0 );
void  retranslate_now( QString val );
QString CPAPaese( const QString  id );
QString Html_Ico( const int nrico  );
inline QTextDocument * document() { return doc->clone(); }
protected:
QString one;
int nummer;
int dbidX;
QStringList list;
QUrl url;
QTextDocument *doc;
QByteArray byteArray;
QSettings setter;
bool having;
QDomElement root;
QString clipboard;
double FattorePerFranco;
QTextStream out;
QMap<QString, QString> search_replacer_it;
QMap<QString, QString> search_replacer_de;
QMap<QString, QString> search_replacer_fr;
QMap<QString, QString> search_replacer_en;
QMap<QString, QString> qbase;
QPixmap image_uno;
QMap<QString, QString> qtrans;
QList<SPics> lipic;
QUrl FirstImageUrl;
QString Tabella_Calendario_documento;
QString ImageUrlFirst;
int Tipo_Oggetto;
QString POINT;
QString CLANG;
QString xp0;
QString xp1;
QString xpx;
QSqlDatabase db;
QString texter( QString value );
void setBaseParams();
QList<IcoLine> icones;
QString legenda_calendario();
QPixmap createColorTool( QColor e  );
QString caratteristiche();
QString tabella_attributi( QString lista );
void MasterBuild();
void openstream();
bool closeStream();
QPixmap createNullPic( int wi , int hi );
QString text();
QString letti();
QString addo();
private:
signals:
public slots:

};
//
#endif // GENDOKUMENT_H

